/*
 * Project: BoboDesignPattern
 * 
 * File Created at 2020年1月8日
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */
package test.practice;

import java.util.Arrays;

/**
 * @Type A20200108_selectsort
 * @Desc
 * @author 52489
 * @date 2020年1月8日
 * @Version V1.0
 */
public class A20200108_selectsort {
    public static void main(String[] args) {

        int[] nums = { 3, 2, 1, 4, 8, 5, 9, 6 };
        selectsort(nums);
        System.out.println(Arrays.toString(nums));

    }

    /**
     * @param nums
     */
    private static void selectsort(int[] nums) {
        for (int i = 0; i < nums.length; i++) {
            int k = i;
            for (int j = i; j < nums.length; j++) {
                if (nums[j] < nums[k]) {
                    k = j;
                }
            }
            int tmp = nums[i];
            nums[i] = nums[k];
            nums[k] = tmp;
        }
    }
}
